﻿using System;
using System.Collections.Generic;
using System.Linq;
using TaskAccess;
using InterService;
using InterService.common;
using EntityClass;
using System.Data;

public partial class admin_admin_video1 : System.Web.UI.Page
{
    //protected System.Web.UI.WebControls.Button Button2;
    //protected System.Web.UI.WebControls.Button Button3;
    //protected System.Web.UI.WebControls.Literal ltl_HTML;

    protected void Page_Load(object sender, EventArgs e)
    {
        //Common pagechk = new Common();
        //pagechk.PageCheck();
        // 在此处放置用户代码以初始化页面
        //this.Button2.Enabled=false;
        string maction = Reqobj.Get("action");
        string mmid = Reqobj.Get("id");
        string Ispost = Reqobj.Post("ispost");
        string mclassid = Reqobj.Get("classid");
        bool PostBack = (Ispost == "" || string.Empty == Ispost) ? false : true;
        int m_id = (mmid == "" || string.Empty == mmid || !RegExp.IsNumeric(mmid)) ? 0 : Convert.ToInt32(mmid);
        int m_classid = (mclassid == "" || string.Empty == mclassid || !RegExp.IsNumeric(mclassid)) ? 0 : Convert.ToInt32(mclassid);
        DTOweb_video web_video = new DTOweb_video();
        DAOweb_video dao_web_video = new DAOweb_video();
        string msg = "";
        switch (maction)
        {
            case "add":
                if (!PostBack)
                {
                    string builder = this.Template;
                    builder = builder.Replace("{$m_action}", "添加");
                    builder = builder.Replace("{$v_title}", "");
                    builder = builder.Replace("{$setup_user}", "");
                    builder = builder.Replace("{$classid}", this.Get_Select_Html("video", m_classid));
                    builder = builder.Replace("{$v_power}", this.Get_Radio_Html("0", "power"));
                    builder = builder.Replace("{$isgood}", this.Get_Radio_Html("0", "isgood"));
                    builder = builder.Replace("{$istop}", this.Get_Radio_Html("1", "istop"));
                    builder = builder.Replace("{$v_url_1}", "");
                    builder = builder.Replace("{$v_url_2}", "");
                    builder = builder.Replace("{$v_url_3}", "");
                    builder = builder.Replace("{$v_url_4}", "");
                    builder = builder.Replace("{$url_title_1}", "片段1");
                    builder = builder.Replace("{$url_title_2}", "片段2");
                    builder = builder.Replace("{$url_title_3}", "片段3");
                    builder = builder.Replace("{$url_title_4}", "片段4");
                    builder = builder.Replace("{$v_remark}", "");
                    builder = builder.Replace("{$v_star}", this.Get_Star(0));
                    this.ltl_HTML.Text = builder;
                }
                else
                {
                    web_video.sign = 0;
                    web_video.v_title = Reqobj.Post("v_title");
                    web_video.setup_user = Reqobj.Post("setup_user");
                    web_video.classid = Convert.ToInt32(Reqobj.Post("classid"));
                    web_video.v_power = Reqobj.Post("v_power");
                    web_video.isgood = Reqobj.Post("isgood");
                    web_video.istop = Reqobj.Post("istop");
                    string _urls = Reqobj.Post("v_url_1") + ",";
                    _urls += Reqobj.Post("v_url_2") + ",";
                    _urls += Reqobj.Post("v_url_3") + ",";
                    _urls += Reqobj.Post("v_url_4");
                    string _titles = Reqobj.Post("url_title_1") + ",";
                    _titles += Reqobj.Post("url_title_2") + ",";
                    _titles += Reqobj.Post("url_title_3") + ",";
                    _titles += Reqobj.Post("url_title_4");
                    web_video.v_url = _urls + "$" + _titles;
                    web_video.v_remark = Reqobj.Post("v_remark");
                    web_video.v_star = Convert.ToInt32(Reqobj.Post("v_star"));
                    web_video.v_urlnum = Convert.ToInt32(Reqobj.Post("v_urlnum"));
                    int ruturnValue = dao_web_video.web_video_edit_w(web_video);
                    Feedback feedback = new Feedback();
                    msg = ruturnValue == 1 ? "添加成功" : "添加失败,请与管理员联系 !";
                    feedback.Throw(msg, null, "返回列表总览,admin_video.aspx?classid=" + m_classid + "|继续添加新类别,admin_video.aspx?classid=" + m_classid + "&action=add", null, false);
                }
                break;
            case "edit":
                if (!PostBack)
                {
                    this.Get_Object(m_id, ref web_video);
                    string builder = this.Template;
                    builder = builder.Replace("{$m_action}", "修改");
                    builder = builder.Replace("{$v_title}", web_video.v_title);
                    builder = builder.Replace("{$setup_user}", web_video.setup_user);
                    builder = builder.Replace("{$classid}", this.Get_Select_Html("video", web_video.classid));
                    builder = builder.Replace("{$v_power}", this.Get_Radio_Html(web_video.v_power, "power"));
                    builder = builder.Replace("{$isgood}", this.Get_Radio_Html(web_video.isgood, "isgood"));
                    builder = builder.Replace("{$istop}", this.Get_Radio_Html(web_video.istop, "istop"));
                    string[] _url = web_video.v_url.Split(new char[] { '$' })[0].Split(new char[] { ',' });
                    string[] _title = web_video.v_url.Split(new char[] { '$' })[1].Split(new char[] { ',' });
                    builder = builder.Replace("{$v_url_1}", _url[0]);
                    builder = builder.Replace("{$v_url_2}", _url[1]);
                    builder = builder.Replace("{$v_url_3}", _url[2]);
                    builder = builder.Replace("{$v_url_4}", _url[3]);
                    builder = builder.Replace("{$url_title_1}", _title[0]);
                    builder = builder.Replace("{$url_title_2}", _title[1]);
                    builder = builder.Replace("{$url_title_3}", _title[2]);
                    builder = builder.Replace("{$url_title_4}", _title[3]);
                    builder = builder.Replace("{$v_remark}", web_video.v_remark);
                    builder = builder.Replace("{$v_star}", this.Get_Star(web_video.v_star));
                    this.ltl_HTML.Text = builder;
                }
                else
                {

                    if (Convert.ToInt32(Reqobj.Post("classid")) != Convert.ToInt32(mclassid))
                    {
                        web_video.sign = 2;
                    }
                    else
                    {
                        web_video.sign = 1;
                    }
                    web_video.v_id = m_id;
                    web_video.v_title = Reqobj.Post("v_title");
                    web_video.setup_user = Reqobj.Post("setup_user");
                    web_video.classid = Convert.ToInt32(Reqobj.Post("classid"));
                    web_video.v_power = Reqobj.Post("v_power");
                    web_video.isgood = Reqobj.Post("isgood");
                    web_video.istop = Reqobj.Post("istop");
                    string _urls = Reqobj.Post("v_url_1") + ",";
                    _urls += Reqobj.Post("v_url_2") + ",";
                    _urls += Reqobj.Post("v_url_3") + ",";
                    _urls += Reqobj.Post("v_url_4");
                    string _titles = Reqobj.Post("url_title_1") + ",";
                    _titles += Reqobj.Post("url_title_2") + ",";
                    _titles += Reqobj.Post("url_title_3") + ",";
                    _titles += Reqobj.Post("url_title_4");
                    web_video.v_url = _urls + "$" + _titles;
                    web_video.v_remark = Reqobj.Post("v_remark");
                    web_video.v_star = Convert.ToInt32(Reqobj.Post("v_star"));
                    web_video.v_urlnum = Convert.ToInt32(Reqobj.Post("v_urlnum"));

                    int ruturnValue = dao_web_video.web_video_edit_w(web_video);
                    Feedback feedback = new Feedback();
                    msg = ruturnValue == 1 ? "修改成功" : "修改失败,请与管理员联系 !";
                    feedback.Throw(msg, null, "返回列表总览,admin_video.aspx?classid=" + m_classid, "admin_video.aspx?classid=" + m_classid, false);
                }
                break;
            case "del":
                web_video.sign = 3;
                web_video.v_id = m_id;
                int ruturn_Value = dao_web_video.web_video_edit_w(web_video);
                Feedback feed_back = new Feedback();
                msg = ruturn_Value == 1 ? "删除成功" : "删除失败,请与管理员联系 !";
                feed_back.Throw(msg, null, "返回列表总览,admin_video.aspx?classid=" + m_classid, "admin_video.aspx?classid=" + m_classid, false);
                break;
            case "list":
                this.ltl_HTML.Text = this.GetClass_list("video");
                break;
            case "move":

                int id = Convert.ToInt32(Reqobj.Get("id"));
                int _mclassid = Convert.ToInt32(Reqobj.Get("_classid"));
                int _order = Convert.ToInt32(Reqobj.Get("_order"));
                string type = Reqobj.Get("type");

                this.UpdateOrder(type, id, _mclassid, _order);

                break;
            default:
                this.ltl_HTML.Text = this.GetHtml_list(3, m_classid);
                break;
        };
    }
    // 模板文件,以后统一存在XML里,统一调用
    private string Template
    {
        get
        {
            string Template_Html = "";
            Template_Html += "<input type='hidden' name='ispost' id='ispost' value='true'>\n";
            Template_Html += "<table align='center' cellpadding='4' cellspacing='1' border='1' class='toptable grid fixed'>\n";
            Template_Html += "	<tr>\n";
            Template_Html += "		<td width='140' class='category'>{$m_action}信息</td>\n";
            Template_Html += "		<td class='category'>带<font class='t2'>*</font>为必填</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td>媒体标题</td>\n";
            Template_Html += "		<td><input type='text' id='v_title' name='v_title' maxlength='100' dataType='UnNull' msg='标题,不能为空' size='64' value='{$v_title}'>&nbsp;<font class='t2'>*</font>\n";
            Template_Html += "		</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td>讲    师</td>\n";
            Template_Html += "		<td><input type='text' id='setup_user' name='setup_user' maxlength='100' dataType='UnNull' msg='讲师,不能为空' size='64' value='{$setup_user}'>&nbsp;<font class='t2'>*</font>\n";
            Template_Html += "		</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td>所属分类</td>\n";
            Template_Html += "		<td>{$classid}&nbsp;<font class='t2'>*</font>\n";
            Template_Html += "		</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td>浏览权限</td>\n";
            Template_Html += "		<td>{$v_power}\n";
            Template_Html += "		</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td>媒体URL<input type='hidden' name='v_urlnum' id='v_urlnum' value='1'></td>\n";
            Template_Html += "		<td>\n";
            Template_Html += "		<input type='text' id='url_title_1' name='url_title_1' maxlength='8' size='10' value='{$url_title_1}'>&nbsp;&nbsp;<input type='text' id='v_url_1' name='v_url_1' maxlength='100' dataType='Url' msg='网路地址,格式不正确' size='50' value='{$v_url_1}'>&nbsp;<font class='t2'>*</font><br>\n";
            Template_Html += "		<input type='text' id='url_title_2' name='url_title_2' maxlength='8' size='10' value='{$url_title_2}'>&nbsp;&nbsp;<input type='text' id='v_url_2' name='v_url_2' maxlength='100' size='50' value='{$v_url_2}'><br>\n";
            Template_Html += "		<input type='text' id='url_title_3' name='url_title_3' maxlength='8' size='10' value='{$url_title_3}'>&nbsp;&nbsp;<input type='text' id='v_url_3' name='v_url_3' maxlength='100' size='50' value='{$v_url_3}'><br>\n";
            Template_Html += "		<input type='text' id='url_title_4' name='url_title_4' maxlength='8' size='10' value='{$url_title_4}'>&nbsp;&nbsp;<input type='text' id='v_url_4' name='v_url_4' maxlength='100' size='50' value='{$v_url_4}'>\n";
            Template_Html += "		</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td>简要描述</td>\n";
            Template_Html += "		<td><textarea name='v_remark' rows='8' id='v_remark' style='width:400px;overflow:auto;'>{$v_remark}</textarea>\n";
            Template_Html += "		</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td>是否推荐</td>\n";
            Template_Html += "		<td>{$isgood}\n";
            Template_Html += "		</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td>是否置顶</td>\n";
            Template_Html += "		<td>{$istop}\n";
            Template_Html += "		</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td>星级推荐</td>\n";
            Template_Html += "		<td>{$v_star}&nbsp;星级</td>\n";
            Template_Html += "	</tr>\n";

            Template_Html += "	<tr>\n";
            Template_Html += "		<td></td>\n";
            Template_Html += "		<td><input type='button' id='btn_save' onclick='video_check();' class='button' value='保 存'>&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' id='btn_back' class='button' value='返 回' onclick='history.go(-1);'><asp:Button id='Button1' runat='server' Text='Button' Height='24px' Width='80px'></asp:Button></td>\n";
            Template_Html += "	</tr>\n";
            Template_Html += "</table>\n";
            return Template_Html;
        }
    }

    private string Get_Star(int _star)
    {
        string _returnHtml = "";
        _returnHtml += "<select name='v_star' id='v_star'>";
        _returnHtml += "<option value='0'>0</option>";
        string _one = _star == 1 ? "selected" : "";
        _returnHtml += "<option value='1' " + _one + ">1</option>";
        _one = _star == 2 ? "selected" : "";
        _returnHtml += "<option value='2' " + _one + ">2</option>";
        _one = _star == 3 ? "selected" : "";
        _returnHtml += "<option value='3' " + _one + ">3</option>";
        _one = _star == 4 ? "selected" : "";
        _returnHtml += "<option value='4' " + _one + ">4</option>";
        _one = _star == 5 ? "selected" : "";
        _returnHtml += "<option value='5' " + _one + ">5</option>";
        _returnHtml += "</select>";
        return _returnHtml;
    }

    private string GetClass_list(string msort)
    {
        DAOweb_sys_class dao_sys_class = new DAOweb_sys_class();
        DTOweb_sys_class dto_sys_class = new DTOweb_sys_class();
        dto_sys_class.sign = 0;
        dto_sys_class.c_sort = msort;
        DataSet dataset = dao_sys_class.web_sys_class_select(dto_sys_class);
        string HtmlContent = "<table align=\"center\" cellpadding=\"4\" cellspacing=\"1\" class=\"toptable grid\" border=\"1\">\n";
        HtmlContent += "	<tr>\n";
        HtmlContent += "		<td nowrap colspan=\"3\"><div class=\"category\" style=\"float:left;background:#EEF7FD;\">多媒体分类列表</div><div style=\"float:right;\"><input type=\"button\" id=\"btn_refresh\" class=\"button\" value=\"刷 新\" onclick=\"location.reload();\"><asp:Button id=\"Button1\" runat=\"server\" Text=\"Button\"></asp:Button>&nbsp;&nbsp;";
        HtmlContent += "			<input type=\"button\" id=\"btn_search\" class=\"button\" value=\"搜 索\" onclick=\"\" disabled></div>";
        HtmlContent += "		</td>\n";
        HtmlContent += "	</tr>\n";

        HtmlContent += "	<tr>\n";
        HtmlContent += "		<td width=\"10%\" nowrap align=\"left\" class=\"category\">分类ID</td><td nowrap class=\"category\">多媒体系列</td><td width=\"30%\" nowrap class=\"category\" align=\"center\">相关操作</td>\n";
        HtmlContent += "	</tr>\n";

        if (dataset != null && dataset.Tables[0].Rows.Count > 0)
        {
            int c_id, c_floor; string c_name;
            for (int i = 0; i < dataset.Tables[0].Rows.Count; i++)
            {
                c_id = (int)dataset.Tables[0].Rows[i]["c_id"];
                c_name = dataset.Tables[0].Rows[i]["c_name"].ToString();
                c_floor = (int)dataset.Tables[0].Rows[i]["c_floor"];
                string tmp1 = "";
                for (int j = 2; j < c_floor + 1; j++)
                { tmp1 += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; }
                HtmlContent += "<tr onmouseover=\"this.className='highlight'\" onmouseout=\"this.className=''\">\n";
                HtmlContent += "<td align=\"left\" height=\"26\">" + c_id + "</td>\n";
                HtmlContent += "<td>" + tmp1 + c_name + "</td>\n";
                HtmlContent += "<td nowrap align=\"center\"><a href=\"?classid=" + c_id + "\">进入管理</a></td>\n";
                HtmlContent += "</tr>\n";
            }
        }

        HtmlContent += "<tr class=\"category\">\n";
        HtmlContent += "	<td align=\"left\" width=\"100%\" colSpan=\"3\" height=\"26\"></td>";
        HtmlContent += "</tr>\n";
        HtmlContent += "</table>\n";
        return HtmlContent;
    }

    private string GetHtml_list(int msign, int mclassid)
    {
        DAOweb_video dao_web_video = new DAOweb_video();
        DTOweb_video dto_web_video = new DTOweb_video();
        dto_web_video.sign = msign;
        dto_web_video.classid = mclassid;
        DataSet dataset = dao_web_video.web_video_select_w(dto_web_video);
        string HtmlContent = "<table align=\"center\" cellpadding=\"4\" cellspacing=\"1\" class=\"toptable grid\" border=\"1\">\n";
        HtmlContent += "	<tr>\n";
        HtmlContent += "		<td nowrap align=\"left\" colspan=\"7\"><div class=\"category\" style=\"float:left;background:#EEF7FD;\">多媒体列表</div><div style=\"float:right;\"><input type=\"button\" id=\"btn_refresh\" class=\"button\" value=\"刷 新\" onclick=\"location.reload();\">&nbsp;&nbsp;";
        HtmlContent += "			<input type=\"button\" id=\"btn_search\" class=\"button\" value=\"搜 索\" onclick=\"\" disabled>&nbsp;&nbsp;<input type=\"button\" id=\"btn_add\" class=\"button\" value=\"添 加\" onclick=\"location.href='?classid=" + mclassid + "&action=add'\">&nbsp;&nbsp;<input type=\"button\" id=\"btn_back\" class=\"button\" value=\"返 回\" onclick=\"location.href='?action=list'\"></div>";
        HtmlContent += "		</td>\n";
        HtmlContent += "	</tr>\n";

        HtmlContent += "	<tr>\n";
        HtmlContent += "		<td width=\"15%\" nowrap class=\"category\">类别</td><td nowrap width=\"40%\" class=\"category\">多媒体名称</td><td width=\"2%\" nowrap class=\"category\">更换次序</td><td width=\"10%\" nowrap class=\"category\">是否推荐</td><td width=\"10%\" nowrap class=\"category\">是否置顶</td><td width=\"10%\" nowrap class=\"category\">浏览权限</td><td width=\"10%\" nowrap class=\"category\" align=\"center\">相关操作</td>\n";
        //HtmlContent += "		<td width=\"5%\" nowrap class=\"category\" align=\"center\">选项</td>\n";
        HtmlContent += "	</tr>\n";
        int sumCount = 0;
        if (dataset != null && dataset.Tables[0].Rows.Count > 0)
        {
            int v_id, classid, c_floor;
            string c_name, v_title, istop, isgood, v_power, c_class, preclass, nextclass, mtype, v_order;
            sumCount = dataset.Tables[0].Rows.Count;
            for (int i = 0; i < dataset.Tables[0].Rows.Count; i++)
            {
                v_id = Convert.ToInt32(StringUtil.Getfield(dataset, "v_id", i));
                classid = Convert.ToInt32(StringUtil.Getfield(dataset, "classid", i));
                c_name = StringUtil.Getfield(dataset, "c_name", i);
                v_title = StringUtil.Getfield(dataset, "v_title", i);
                istop = StringUtil.Getfield(dataset, "istop", i) == "0" ? "否" : "是";
                isgood = StringUtil.Getfield(dataset, "isgood", i) == "0" ? "否" : "是";
                v_power = StringUtil.Getfield(dataset, "v_power", i) == "0" ? "非用户" : "益盟用户";
                c_class = StringUtil.Getfield(dataset, "c_class", i);
                v_order = StringUtil.Getfield(dataset, "v_order", i);
                mtype = StringUtil.Getfield(dataset, "type", i);
                c_floor = Convert.ToInt32(StringUtil.Getfield(dataset, "c_floor", i));

                preclass = (i == 0) ? "" : StringUtil.Getfield(dataset, "c_class", i - 1);
                nextclass = i == (sumCount - 1) ? "" : StringUtil.Getfield(dataset, "c_class", i + 1);
                //m_support =StringUtil.Getfield(dataset,"m_softtype",i)=="0"?"不支持":"支持";					
                string tmp = "";
                for (int j = 2; j < c_floor + 1; j++)
                { tmp += "&nbsp;&nbsp;&nbsp;&nbsp;"; }
                if (c_class != preclass)
                {
                    HtmlContent += "<tr class=\"category\">\n";
                    HtmlContent += "	<td align=\"left\" width=\"100%\" colSpan=\"7\" height=\"26\">" + mtype + "</td>";
                    HtmlContent += "</tr>\n";
                }
                HtmlContent += "<tr onmouseover=\"this.className='highlight'\" onmouseout=\"this.className=''\" ondblclick=\"alert('" + v_id + "')\">\n";
                HtmlContent += "<td height=\"26\">" + tmp + c_name + "</td>";
                HtmlContent += "<td>" + v_title + "</td>";
                HtmlContent += "<td align=\"center\"><IMG alt=\"\" style=\"cursor:pointer;\" src=\"images/340.gif\" onclick=\"img_move('up','" + v_id + "','" + v_order + "','" + classid + "')\">\n<IMG alt=\"\" src=\"images/339.gif\" style=\"cursor:pointer;\" onclick=\"img_move('down','" + v_id + "','" + v_order + "','" + classid + "')\"></td>\n";
                HtmlContent += "<td>" + isgood + "</td>";
                HtmlContent += "<td>" + istop + "</td>";
                HtmlContent += "<td>" + v_power + "</td>";
                HtmlContent += "<td nowrap align=\"center\"><a href=\"?classid=" + mclassid + "&action=edit&id=" + v_id + "\">修改</a>&nbsp;&nbsp;<a href=\"?classid=" + mclassid + "&action=del&id=" + v_id + "\" onclick=\"javascript:if(!confirm('确认要删除该条记录 ?'))return false;\">删除</a>&nbsp;&nbsp;<a href=\"admin_videoimg_add.aspx?classid=" + mclassid + "&v_id=" + v_id + "\">加图</a></td>";

                HtmlContent += "</tr>\n";
            }
        }
        HtmlContent += "<tr class=\"category\">\n";
        HtmlContent += "	<td align=\"left\" width=\"100%\" colSpan=\"7\" height=\"26\"></td>";
        //HtmlContent += "	<td></td>\n";
        HtmlContent += "</tr>\n";
        HtmlContent += "</table>\n";
        return HtmlContent;
    }


    private string Get_Select_Html(string msort, int mcid)
    {
        DAOweb_sys_class dao_sys_class = new DAOweb_sys_class();
        DTOweb_sys_class dto_sys_class = new DTOweb_sys_class();

        dto_sys_class.sign = 0;
        dto_sys_class.c_sort = msort;
        DataSet dataset = dao_sys_class.web_sys_class_select(dto_sys_class);
        string HtmlContent = "<select name='classid' id='classid' dataType='Require' msg='所属分类,不能为空'><option value=''>请选择分类</option>";
        if (dataset != null && dataset.Tables[0].Rows.Count > 0)
        {
            int c_id, c_floor; string c_name, tmp1, tem2 = "";
            for (int i = 0; i < dataset.Tables[0].Rows.Count; i++)
            {
                c_id = (int)dataset.Tables[0].Rows[i]["c_id"];
                c_name = dataset.Tables[0].Rows[i]["c_name"].ToString();
                c_floor = (int)dataset.Tables[0].Rows[i]["c_floor"];
                tmp1 = "";
                for (int j = 2; j < c_floor + 1; j++)
                { tmp1 += "--"; }
                tem2 = mcid == c_id ? "selected" : "";
                HtmlContent += "<option value='" + c_id + "' " + tem2 + ">" + tmp1 + c_name + "</option>";
            }
        }
        HtmlContent += "</select>";
        return HtmlContent;
    }

    private string Get_Radio_Html(string key, string type)
    {
        string RadioHtml = "";
        switch (type)
        {
            case "isgood":
                string chk = (key == "0") ? "checked" : "";
                RadioHtml += "<input type='radio' id='isgood' name='isgood' value='0' class='nogrid' " + chk + ">否&nbsp;&nbsp;";
                chk = (key == "1") ? "checked" : "";
                RadioHtml += "<input type='radio' id='isgood' name='isgood' value='1' class='nogrid' " + chk + ">是";
                break;
            case "istop":
                chk = (key == "0") ? "checked" : "";
                RadioHtml += "<input type='radio' id='istop' name='istop'  value='0' class='nogrid' " + chk + ">否&nbsp;&nbsp;";
                chk = (key == "1") ? "checked" : "";
                RadioHtml += "<input type='radio' id='istop' name='istop'  value='1' class='nogrid' " + chk + ">是";
                break;
            case "power":
                chk = (key == "0") ? "checked" : "";
                RadioHtml += "<input type='radio' id='v_power' name='v_power'  value='0' class='nogrid' " + chk + ">非用户&nbsp;&nbsp;";
                chk = (key == "1") ? "checked" : "";
                RadioHtml += "<input type='radio' id='v_power' name='v_power'  value='1' class='nogrid' " + chk + ">益盟用户";
                break;
        };
        return RadioHtml;
    }
    //更新信息的位置up and down
    public void UpdateOrder(string type, int v_id, int classid, int v_order)
    {
        DAOweb_video dao_web_video = new DAOweb_video();
        DTOweb_video dto_web_video = new DTOweb_video();
        if (type == "up")
        {
            dto_web_video.sign = 7;
        }
        else
        {
            dto_web_video.sign = 8;
        }
        dto_web_video.v_id = v_id;
        dto_web_video.classid = classid;
        dto_web_video.v_order = v_order;


        dao_web_video.web_video_edit_w(dto_web_video);

    }
    private object Get_Object(int v_id, ref DTOweb_video dto_video_obj)
    {
        DAOweb_video dao_web_video = new DAOweb_video();
        DTOweb_video dto_web_video = new DTOweb_video();

        dto_web_video.sign = 2;
        dto_web_video.v_id = v_id;

        DataSet dataset = dao_web_video.web_video_select_w(dto_web_video);
        if (dataset != null && dataset.Tables[0].Rows.Count > 0)
        {
            dto_video_obj = new DTOweb_video(dataset.Tables[0].Rows[0]);
            return dto_video_obj;
        }
        else
        {
            return null;
        }
    }

    #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
        //
        // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
        //
        InitializeComponent();
        base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
        this.Button2.Click += new System.EventHandler(this.Button2_Click);
        this.Button3.Click += new System.EventHandler(this.Button3_Click);
        this.Load += new System.EventHandler(this.Page_Load);

    }
    #endregion

    private void Button2_Click(object sender, System.EventArgs e)
    {
        ISweb_service webs = new ISweb_service();
        if (webs.UpdateContentFile())
        {
            Page.Response.Write("<script>alert('客服首页发布成功！');location.href='admin_video.aspx?action=list';</script>");
        }
        else
        {
            Page.Response.Write("<script>alert('客服首页发布失败！');location.href='admin_video.aspx?action=list';</script>");
        }
    }

    private void Button3_Click(object sender, System.EventArgs e)
    {
        ISweb_service webs = new ISweb_service();
        if (webs.UpdateListFile())
        {
            Page.Response.Write("<script>alert('新闻列表页发布成功！');location.href='admin_video.aspx?action=list';</script>");
        }
        else
        {
            Page.Response.Write("<script>alert(''新闻列表页发布失败！');location.href='admin_video.aspx?action=list';</script>");
        }
    }
}